/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package filmlibrary.web;

import filmlibrary.orm.ORMHelper;
import filmlibrary.orm.classes.Films;
import filmlibrary.orm.classes.Users;
import java.util.List;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author karol
 */
@ManagedBean
@RequestScoped
public class ProfileBean {
    private static final Logger logger = Logger.getLogger("filmlibrary.web.ProfileBean");
    private ORMHelper orm = new ORMHelper();
    private Users user = new Users();    
    /** Creates a new instance of FilmsBean */
    public ProfileBean() {
        user = orm.getUserbyName(new SessionBean().getLogin());
    }

    public Users getUser() {
        return user;
    }

    public void setUser(Users user) {
        this.user = user;
    }
    public String editProfile(){
        orm.updateUser(user);
        return "profile.xhtml?faces-redirect=true";
    }
}
